package com.sangeng.ss.controller;

import com.sangeng.ss.domain.ResponseResult;
import com.sangeng.ss.domain.User;
import com.sangeng.ss.service.LoginService;
import com.sangeng.ss.utils.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：xxx
 * @description：TODO
 * @date ：2024/02/28 14:17
 */
@RestController
public class LoginController {

    @Autowired
    private LoginService loginservice;

    @PostMapping("user/login")
    public ResponseResult login(@RequestBody User user){
//        return ExceptionUtils.eatException(()->loginservice.login(user));

        return loginservice.login(user);
    }

    @PostMapping("user/logout")
    public ResponseResult logOut(){
        return loginservice.logOut();
    }
}
